// eduData/eduDatacom/dataCard/dataCard.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
   eduCard:{ 
     type:Array,
     value:[,,,]
   },
   type:{
     type:String,
     value:'word'
   },
   title:{
     type:String,
     value:'新概念英语教案'
   },
   nums:{
     type:Number,
     value:100
   },
   des:{
     type:String,
     value:'大学新概念英语精讲2+3+4册'
   },
   url:{
     type:String,
     value:''
   }
  },

  /**
   * 组件的初始数据
   */
  data: {
    iconType:'http://icon.tongchengyouzhi.com/study_source/word.png'
    // iconword:'http://icon.tongchengyouzhi.com/study_source/word.png',
    // iconppt:'http://icon.tongchengyouzhi.com/study_source/ppt.png',
    // iconexcel:'http://icon.tongchengyouzhi.com/study_source/excel.png'
  },
  attached:function(event){
    // console.log(11111)
     var type=this.properties.type
     console.log(type)
     if(type=='doc'||type=='docx'){
       this.setData({
         iconType:'http://icon.tongchengyouzhi.com/study_source/word.png'
       })
     }else if(type=='xls'||type=='xlsx'){
       this.setData({
         iconType: 'http://icon.tongchengyouzhi.com/study_source/excel.png'
       })
     }else if(type=='ppt'||type=='pptx'){
       this.setData({
         iconType: 'http://icon.tongchengyouzhi.com/study_source/ppt.png'
       })
     }else if(type=='pdf'||type=='pdfx'){
       this.setData({
         iconType: 'http://icon.tongchengyouzhi.com/study_source/pdf.png'
       })
     }
  },
  /**
   * 组件的方法列表
   */
  methods: {
     download:function(event){
       var url=this.properties.url
       this.triggerEvent('down',{url})
     },
     onlineRead:function(event){
       var url = this.properties.url

       var type=this.properties.type
       this.triggerEvent('read',{url,type})
     }
  }
})
